/*************************************************************************
	> File Name: 101.对称二叉树.c
	> Author: Maureen 
	> Mail: Maureen@qq.com 
	> Created Time: 三  9/15 12:37:22 2021
 ************************************************************************/

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

bool isSame(struct TreeNode *left_node, struct TreeNode *right_node) {
    if (left_node == NULL && right_node == NULL) return true;
    if (left_node == NULL || right_node == NULL || left_node->val != right_node->val) return false;
    return isSame(left_node->left, right_node->right) && isSame(left_node->right, right_node->left);
}

bool isSymmetric(struct TreeNode* root){
    return isSame(root->left, root->right);
}
